﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AudioCallback : MonoBehaviour
{
    private AudioSource audio;

    // Start is called before the first frame update
    void Start()
    {

    }

    public void init()
    {
        audio = gameObject.GetComponent<AudioSource>();
        audio.Play();
        StartCoroutine("Callback");
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    IEnumerator Callback()
    {
        Debug.Log(audio.clip.length);
        yield return new WaitForSeconds(audio.clip.length);
        Destroy(gameObject);
    }
}
